<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<style type="text/css" media="print">
TD {font-size:11px; font-family="arial,helvetica"}
P {text-indent:-10; text-align="justify"; margin-left:10;}
A:link {color: #44aaaa; text-decoration: underline;}
A:active {color: #000000; text-decoration: underline;}
A:visited {color: #227788; text-decoration: underline;}
A:hover {color: #000000; text-decoration: none; }
BODY {font-size:12px; font-family="arial,helvetica";}
FORM {margin-top:5}
</style>
<style type="text/css" media="screen">
TD {font-size:13px}
P {text-indent:-10; text-align="justify"; margin-left:10;}
A:link {color: #44aaaa; text-decoration: underline;}
A:active {color: #000000; text-decoration: underline;}
A:visited {color: #227788; text-decoration: underline;}
A:hover {color: #000000; text-decoration: none;}
BODY {background-image: url(images/captext.gif); font-size:14px}
FORM {margin-top:5}
</style>
</head>

<body>
<p style="text-align: right;">
	<a href="rss.php" target="_blank">
	<img src="images/rss.png" alt="RSS" height="16" width="16" style="border: 0px;"> Feed RSS
	</a>
</p>
<center><font color="#228888" size="4"><br><b>BACHECA: AVVISI, SCADENZE, EVENTI, NOVIT&Agrave;</b><br><br></font></center>
<center>
<?php
require("include/config.inc.php");
require("include/mysql.inc.php");

$db = new MySQL();

$db->connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_DEBUG);

$db->query("SELECT * FROM Annuncio_pubblicato WHERE data_sca + 1 <= CURDATE()");

if($db->get_num_rows() > 0)
{
	while($row = $db->fetch_array())
	{
		$db->query("INSERT INTO Annuncio_scaduto VALUES('','" . $row["data_pub"] . "','" . $row["data_sca"] . "','" . $db->escape($row["corpo"]) . "','" . $db->escape($row["autore"]) . "','" . $row["utente"] ."')");
		$db->query("DELETE FROM Annuncio_pubblicato WHERE codice = '" . $row["codice"] . "'");
	}
}

$db->query("SELECT * FROM Annuncio_pubblicato ORDER BY data_pub DESC, codice DESC");

if($db->get_num_rows() > 0)
{
	while($row = $db->fetch_array())
	{
		$d_pub = date("d/m/Y", strtotime($row["data_pub"]));
		$d_sca = date("d/m/Y", strtotime($row["data_sca"]));
		
		echo "<table style=\"table-layout: fixed; width:90%; margin-left: auto; margin-right: auto;\">
			  <tr bgcolor=\"#FFDFBF\">
				<td><b>Pubblicato in data: <font color=\"#228888\" size=\"3\">$d_pub</font></b></td>
				<td align=\"right\"><b>Autore: </b>" . $row["autore"] . "</td>
				<td align=\"right\"><b>Scadenza: </b>$d_sca</td>
			  </tr>
			  <tr><td colspan=\"3\">" . str_replace("\n", "<br>", $row["corpo"]) . "</td></tr>
			  </table>";
	}
}
else
	echo "<span style=\"text-align: center; font-weight: bold; color: black;\">Non ci sono annunci pubblicati.</span>";

$db->free_result();
$db->close();
?>
<br><br>
<table style="width: 90%; text-align: left; margin-left: auto; margin-right: auto;" border="0" cellpadding="2" cellspacing="2">
<tr>
	<td style="vertical-align: middle; text-align: center;">
		<a href="scaduti.php">Avvisi Scaduti</a><br>
		<a href="ricerca_msg.php">Cerca nei Messaggi</a>
	</td>
	<td style="vertical-align: middle; text-align: center;"><a href="https://server2.sti.uniurb.it/bacheca_info_appl_liv1/login.php">Gestione Avvisi</a></td>
</tr>
</table>
</center>
<br>
<table bgcolor="#88CCCC" border="0" cellpadding="1" cellspacing="0" width="100%">
<tr>
	<td>Ultima modifica: <?php echo date("d/m/Y");?></td>
	<td align="right">Approvato da: Presidente CCdL</td>
</tr>
</table>
</body>
</html>
